package com.inspur.demo.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.validation.ValidationException;

/**
 * @ClassName ExceptionController
 * @Description TODO
 * @Company inspur
 * @Author Mark.Zhang
 * @Date 2019/5/17 11:19
 * @Version 1.0 
 */
@Controller
public class ExceptionController {
    @RequestMapping(value = "/ex")
    @ResponseBody
    public String ex(int n) throws Exception {
        if (n == 1) {
            throw new ValidationException();
        }
        return "Hello world";
    }
}
